package com.yty.demo._4_oop;

/**
 * @author: yangtaoyao
 * @time: 2020/1/9 16:06
 * @description: 抽象类应用
 */
public abstract class Employee {
    private int id;
    private String name;
    private double salary;

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public double getSalary() {
        return salary;
    }

    public void setSalary(double salary) {
        this.salary = salary;
    }

    Employee() {}

    public Employee(int id, String name, double salary) {
        this.id = id;
        this.name = name;
        this.salary = salary;
    }

    public abstract void work();
}

class CommonEmployee extends Employee {
    public CommonEmployee() {
    }

    public CommonEmployee(int id, String name, double salary) {
        super(id, name, salary);
    }

    @Override
    public void work() {
        System.out.println("CommonEmployee.work()");
    }
}

class Manager extends Employee {
    public Manager(float bonus) {
        this.bonus = bonus;
    }

    public Manager(int id, String name, double salary, float bonus) {
        super(id, name, salary);
        this.bonus = bonus;
    }

    private float bonus;

    public float getBonus() {
        return bonus;
    }

    public void setBonus(float bonus) {
        this.bonus = bonus;
    }

    @Override
    public void work() {
        System.out.println("Manager.work()");
    }

    public static void main(String[] args) {
        Employee e1=new CommonEmployee(1,"小李",10000);
        e1.work();

        Employee e2=new Manager(2,"王经理",20000,100);
        e2.work();
    }
}